/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Ap0stoL2
 * Date: 2023-07-21
 * Time: 13:45
 */
public class test1 {
    public static int getElement(int[] array, int index) {
        if (null == array) {
            throw new NullPointerException("传递的数组为null");
        }
        if (index < 0 || index >= array.length) {
            throw new ArrayIndexOutOfBoundsException("传递的数组下标越界");
        }
        return array[index];
    }
    public static void main(String[] args) {
        int[] array = {1, 2, 3};
        getElement(array, 3);
    }
}
